package javaTeste.tClasse;

import java.Metodo;
import java.atributo.Atributo;
import java.classe.Classe;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

public class TesteClasseComMetodosEAtributos implements Especificacao4 {

	Classe agua = null;

	@Before
	public void up() {
		agua = new Classe("Agua");
	}

	@Test
	public void classeAguaComClasseFogoETerra() {
		agua.addMetodo(new Metodo("agua"));
		agua.addMetodo(new Metodo("fogo"));
		agua.addClasse(new Classe("Terra"));
		Assert.assertEquals(
				"class Agua{void agua(){}void fogo(){}class Terra{}}", agua
						.codigoFonte());

	}

	@Test
	public void classeAguaMetodoAgua() {
		agua.addMetodo(new Metodo("agua"));
		Assert.assertEquals("class Agua{void agua(){}}", agua.codigoFonte());
	}

	@Test
	public void classeAguaMetodoAguaEFogo() {
		agua.addMetodo(new Metodo("agua"));
		agua.addMetodo(new Metodo("fogo"));
		Assert.assertEquals("class Agua{void agua(){}void fogo(){}}", agua
				.codigoFonte());
	}

	@Test
	public void classeAguaComAtributoIntA_B_ObjetoTerraX() {
		agua.addAtributo(new Atributo("int", "a"));
		agua.addAtributo(new Atributo("int", "b"));
		agua.addAtributo(new Atributo("Terra", "x"));
		Assert.assertEquals("class Agua{int a;int b;Terra x;}", agua
				.codigoFonte());
	}

	@Test
	public void classeAguaComAtributoIntA_BFinalizado() {
		agua.addAtributo(new Atributo("int", "a",true));
		agua.addAtributo(new Atributo("int", "b",true));
		Assert.assertEquals("class Agua{int a;int b;}", agua
				.codigoFonte());
	}

	@Test
	public void classeAguaComAtributoIntAgua() {
		agua.addAtributo(new Atributo("int", "agua"));
		Assert.assertEquals("class Agua{int agua;}", agua.codigoFonte());
	}

}
